package collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;

public class CollectionDemo3 {
    public static void main(String[] args) {
        Collection c1 = new ArrayList();
        c1.add("java");
        c1.add("c++");
        c1.add("python");
        System.out.println(c1);
        Collection c2 = new HashSet();
        c2.add("android");
        c2.add("ios");
        c2.add("java");
        c1.addAll(c2);
        System.out.println(c2);
        System.out.println(c1);
        c2.addAll(c1);
        System.out.println(c2);
        Collection c3 = new ArrayList();
        c3.add("php");
        c3.add("python");
        c3.add("java");
        System.out.println(c1);
        System.out.println(c3);
        //c1.retainAll(c3);
        System.out.println(c1);
        System.out.println(c3);
        System.out.println("==============");
        c3.removeAll(c1);
        System.out.println(c3);
        System.out.println("==============");
        Collection c4 = new ArrayList<>();
        c4.add("java");
        c4.add("php");
        boolean containsAll = c3.containsAll(c4);
        System.out.println(containsAll);

        Collection c22 = new HashSet();
        c22.add("android");
        c22.add("ios");
        c22.add("java");
        System.out.println("c22:"+c22);

        Collection c33 = new ArrayList();
        c33.add("php");
        c33.add("java");
        c33.add("c++");
        System.out.println("c33:"+c33);

        c22.removeAll(c33);
        System.out.println(c22);


    }
}
